package me.youline.dataServer.dao.socialActionMsg;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import me.youline.dataServer.entity.socialActionMsg.SocialActionFollowingMsg;

import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;

/**
 * 社交行为通知消息关注通知DAO
 * @author linhan
 *
 */
@Component
public class SocialActionFollowingMsgDAO extends AbstractSocialActionMsgDAO<SocialActionFollowingMsg>{

	private static final String TABLE_NAME = "yline_social_notice_msg_following";
	
	private static final RowMapper<SocialActionFollowingMsg> ROW_MAPPER = new SocialActionMsgRowMapper<SocialActionFollowingMsg>(new SocialActionFollowingMsg()){

		@Override
		protected void doSpecialMapRow(SocialActionFollowingMsg msg,
				ResultSet rs, int rowNum) throws SQLException {	
		}
		
	};
	
	/**
	 * 根据发起人ID与被关注者ID查询关注通知动态
	 * @param userId
	 * @param followingId
	 * @return
	 */
	public List<Long> getMsgIdsByUserAndFollowing(Long userId,Long followingId){
		ConditionBuilder builder = new ConditionBuilder();
		builder.addEqCondition("initiator", userId);
		builder.addEqCondition("targetId", followingId);
		return this.getMsgIdsByCondition(builder);
	}
	
	@Override
	protected void initMsgAddData(SocialActionFollowingMsg msg,
			Map<String, Object> map) {
		return;
	}

	@Override
	protected String getTableName() {
		return TABLE_NAME;
	}

	@Override
	protected RowMapper<SocialActionFollowingMsg> getEntityInnerRowMapper() {
		return ROW_MAPPER;
	}

}
